package com.isunland.managesystem.entity;

import android.content.Context;

@SuppressWarnings("unused") public class HintNumber {
  public static final int MESSAGE = 0;
  public static final int TASK = 1;
  public static final int APPROVE = 2;
  public static final int ANNOUNCEMENT = 3;
  private static final int WORKPROCESS = 4;
  private static final int SCORE = 5;//奖惩积分
  private static final int PERSON_PALN = 6;//个人计划
  private static final int DEPT_PLAN = 7;//部门计划
  private static HintNumber sHintNumber;
  private int mTaskNumber;
  private int mMessageNumber;
  private int mPlanApproveNumber;
  private int mAnnouncementNumber;
  private int mWorkprocessNumber;
  private int mScoreNumber;
  private int mPersonPlanNumber;
  private int mDeptPlanNumber;
  private Context mAppContext;

  private HintNumber(int taskNumber, int messageNumber, int planApproveNumber,
      int announcementNumber, int workprocessNumber, Context appContext) {
    super();
    mTaskNumber = taskNumber;
    mMessageNumber = messageNumber;
    mPlanApproveNumber = planApproveNumber;
    mAppContext = appContext;
    mAnnouncementNumber = announcementNumber;
    mWorkprocessNumber = workprocessNumber;
  }

  private HintNumber(int taskNumber, int messageNumber, int planApproveNumber, Context appContext) {
    super();
    mTaskNumber = taskNumber;
    mMessageNumber = messageNumber;
    mPlanApproveNumber = planApproveNumber;
    mAppContext = appContext;
  }

  public static HintNumber newInstance(Context context, int taskNumber, int messageNumber,
      int planApproveNumber) {
    if (sHintNumber == null) {

      sHintNumber = new HintNumber(taskNumber, messageNumber, planApproveNumber,
          context.getApplicationContext());
    }

    return sHintNumber;
  }

  public static HintNumber newInstance(Context context, int taskNumber, int messageNumber,
      int planApproveNumber, int announcementNumber, int workprocessNumber) {
    if (sHintNumber == null) {

      sHintNumber = new HintNumber(taskNumber, messageNumber, planApproveNumber, announcementNumber,
          workprocessNumber, context.getApplicationContext());
    }

    return sHintNumber;
  }

  public static HintNumber newInstance(Context context) {
    if (sHintNumber == null) {

      sHintNumber = new HintNumber(0, 0, 0, context.getApplicationContext());
    }

    return sHintNumber;
  }

  public int getTaskNumber() {
    return mTaskNumber;
  }

  public void setTaskNumber(int taskNumber) {
    mTaskNumber = taskNumber;
  }

  public int getMessageNumber() {
    return mMessageNumber;
  }

  public void setMessageNumber(int messageNumber) {
    mMessageNumber = messageNumber;
  }

  public int getPlanApproveNumber() {
    return mPlanApproveNumber;
  }

  public void setPlanApproveNumber(int planApproveNumber) {
    mPlanApproveNumber = planApproveNumber;
  }

  public int getmAnnouncementNumber() {
    return mAnnouncementNumber;
  }

  public void setmAnnouncementNumber(int mAnnouncementNumber) {
    this.mAnnouncementNumber = mAnnouncementNumber;
  }

  public int getmWorkprocessNumber() {
    return mWorkprocessNumber;
  }

  public void setmWorkprocessNumber(int mWorkprocessNumber) {
    this.mWorkprocessNumber = mWorkprocessNumber;
  }

  public int getmScoreNumber() {
    return mScoreNumber;
  }

  public void setmScoreNumber(int mScoreNumber) {
    this.mScoreNumber = mScoreNumber;
  }

  public int getmPersonPlanNumber() {
    return mPersonPlanNumber;
  }

  public void setmPersonPlanNumber(int mPersonPlanNumber) {
    this.mPersonPlanNumber = mPersonPlanNumber;
  }

  public int getmDeptPlanNumber() {
    return mDeptPlanNumber;
  }

  public void setmDeptPlanNumber(int mDeptPlanNumber) {
    this.mDeptPlanNumber = mDeptPlanNumber;
  }

  /**
   * 减少一个提醒
   *
   * @param type 提醒类型 0代表消息,1代表人物,2代表审批.
   */
  public void reduce(int type) {
    switch (type) {
      case MESSAGE:
        mMessageNumber = reduceNumber(mMessageNumber);

        break;
      case TASK:
        mTaskNumber = reduceNumber(mTaskNumber);
        break;
      case APPROVE:
        mPlanApproveNumber = reduceNumber(mPlanApproveNumber);
        break;
      case ANNOUNCEMENT:
        mAnnouncementNumber = reduceNumber(mAnnouncementNumber);
        break;
      case WORKPROCESS:
        mWorkprocessNumber = reduceNumber(mWorkprocessNumber);
        break;
      case SCORE:
        mScoreNumber = reduceNumber(mScoreNumber);
        break;
      case PERSON_PALN:
        mPersonPlanNumber = reduceNumber(mPersonPlanNumber);
        break;
      case DEPT_PLAN:
        mDeptPlanNumber = reduceNumber(mDeptPlanNumber);
        break;

      default:
        break;
    }
  }

  private int reduceNumber(int number) {
    if (number > 0) {
      return number - 1;
    } else {
      return 0;
    }
  }
}
